package com.brkj.util.view;

import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.widget.*;
import com.brkj.main.R;

import java.util.HashMap;
import java.util.List;

/**
 * Created by colin.ding on 2014/5/23.
 */

public class CommonDialog {
    protected TextView msgTextView;
    protected Button ok;

    protected Dialog dialog;

    public CommonDialog(Context context, String msg, final View.OnClickListener listener) {
        dialog = new Dialog(context, R.style.MyCustomDialog);
        dialog.setContentView(R.layout.base_dialog_sign_btn_view);

        msgTextView = (TextView) dialog.findViewById(R.id.msg);
        ok = (Button) dialog.findViewById(R.id.ok);

        msgTextView.setText(msg);

        ok.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                listener.onClick(v);
                dismiss();
            }
        });

        dialog.setCancelable(false);
        dialog.setCanceledOnTouchOutside(false);
    }

    public void show(){
        dialog.show();
    }

    public void dismiss(){
        dialog.dismiss();
    }
}